//引入express模块
const express = require('express');
//创建路由对象
const router = express.Router();
//导入expressjoi模块
const expressJoi = require('@escook/express-joi');

// 导入userinfo的路由处理模块
const userinfoHandler = require('../router_handle/userinfo')
// 导入userinfo的路由参数验证模块
const {
  name_limit,
  email_limit,
  password_limit,
  forgetPassword_limit,
} = require('../limit/user.js');
const e = require('express');

// 上传头像
router.post('/uploadAvatar', userinfoHandler.uploadAvatar)
// 用户头像绑定账号
router.post('/bindAccount', userinfoHandler.bindAccount)
// 修改用户密码
router.post('/changePassword', expressJoi(password_limit), userinfoHandler.changePassword)
// 获取用户信息
router.post('/getUserInfo', userinfoHandler.getUserInfo)
//修改用户姓名
router.post('/changeName', expressJoi(name_limit), userinfoHandler.changeName)
//修改用户性别
router.post('/changeSex', userinfoHandler.changeSex)
//修改用户邮箱
router.post('/changeEmail', expressJoi(email_limit), userinfoHandler.changeEmail)
// 用户登录页面忘记密码
router.post('/verifyAccountAndEmail', userinfoHandler.verifyAccountAndEmail)
// 用户登录页面修改密码
router.post('/changePasswordInLogin', expressJoi(forgetPassword_limit), userinfoHandler.changePasswordInLogin)

 //导出路由对象
module.exports = router;